{namespace lfe=SGalinski\Lfeditor\ViewHelpers}
{namespace core=TYPO3\CMS\Core\ViewHelpers}

<f:layout name="Default" />

<f:section name="selectItems">
	<f:render partial="SelectExtensionAndLanguageFile" arguments="{_all}" />
	<div class="row">
		<f:form id="mainMenuForm" action="changeSelection">
			<f:render partial="SelectConstant" arguments="{_all}" />
		</f:form>
	</div>
</f:section>

<f:section name="main">
	<f:if condition="{extensionSelection} && {languageFileSelection} && {constantSelection} && {constantSelection} != '###default###'">
		<div class="panel panel-default">
			<div class="panel-heading">
				<f:translate key="function.const.edit.edit" />
			</div>
			<div class="panel-body">
				<f:form id="contentForm" action="editConstantSave">
					<f:for each="{languages}" key="lang" as="constValue" iteration="iterator">
						<fieldset class="tx-lfeditor-fieldset bgColor5 {f:if(condition: iterator.isEven, then: 'tx-lfeditor-fright', else: 'tx-lfeditor-fleft')}">
							<legend class="bgColor3">
								{f:if(condition: '{lang} == \'default\'', then: 'en', else: '{lang}')}
							</legend>
							<f:if condition="{lang} == {defaultLanguage} && {defaultLanguagePermission} != 1">
								<f:then>
									<f:form.textarea
										cols="80" rows="{numTextAreaRows}"
										value="{constValue}"
										name="editConstTextArea[{lang}][{constantSelection}]"
										lang="{f:if(condition: '{lang} == \'default\'', then: 'en', else: '{lang}')}"
										additionalAttributes="{readonly: ''}"
										class="tx-lfeditor-textarea" />
								</f:then>
								<f:else>
									<f:form.textarea
										cols="80" rows="{numTextAreaRows}"
										value="{constValue}"
										name="editConstTextArea[{lang}][{constantSelection}]"
										lang="{f:if(condition: '{lang} == \'default\'', then: 'en', else: '{lang}')}"
										class="tx-lfeditor-textarea" />
								</f:else>
							</f:if>
						</fieldset>
					</f:for>
				</f:form>
			</div>
		</div>
	</f:if>
</f:section>

<f:section name="ButtonBarLeft">
	<button class="btn btn-default btn-sm" onclick="document.getElementById('contentForm').submit();">
		<core:icon identifier="actions-save" />
		<f:translate key="button.save" />
	</button>
</f:section>
